package com.qingcloud.adminbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qingcloud.adminbackend.entity.usergroup.SysUsergroupUser;
import com.qingcloud.adminbackend.entity.usergroup.SysUsergroupUserDTO;
import com.qingcloud.adminbackend.entity.usergroup.SysUsergroupUserParam;
import com.qingcloud.adminbackend.pojo.app.AppUserDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户组和用户关系表 Mapper 接口
 * </p>
 *
 * @author wangjinnan
 * @since 2018-11-16
 */
public interface SysUsergroupUserMapper extends BaseMapper<SysUsergroupUser> {

    /**
     * 批量保存数据
     */
    int insertList(@Param("pojos") List<SysUsergroupUser> userList);

    /**
     * 根据用户信息查询用户组ID
     */
    List<String> findUserGroupByUser(@Param("fullName") String fullName, @Param("mobileno") String mobileno,
                                     @Param("userName") String userName);

    /**
     * 分页查询用户组下成员
     *
     * @param page
     * @param param
     * @return
     */
    IPage<SysUsergroupUserDTO> page(Page page, @Param("param") SysUsergroupUserParam param);

    /**
     * 搜索应用下用户
     */
    Page<AppUserDTO> pageAppUser(Page page, @Param("name") String name, @Param("groupId") String groupId);

    /**
     * 统计团队数量
     */
    Integer countTeam(@Param("userId") String userId);

}
